package com.itheima.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

public class AopAdvice {
        public void before(JoinPoint jp){
            //通过Joinpoint参数获取调用原始方法携带的参数x
            Object[] args = jp.getArgs();
            System.out.println("before.."+args[0]);
        }
/*//前置通知调用
    public void before1(int x, int y) {
        System.out.println("before (int).."+x+y);
    }
//后置通知调用
    public void after(JoinPoint jp){
        Object[] args = jp.getArgs();
        System.out.println("after.."+args[0]);
    }
//返回后通知
    public void afterReturing (Object ret){
        System.out.println("afterReturing.."+ret);
    }*/

 /*   public void afterThrowing(Throwable t){
        System.out.println("afterThrowing.."+t.getMessage());
    }

    public Object arount(ProceedingJoinPoint pjp){
        System.out.println("around before..");
        Object ret = null;
        try {
            //对原始方法的调用
            ret = pjp.proceed();
        } catch (Throwable throwable) {
            System.out.println("around after.."+ret);
        }
        System.out.println("around after.."+ret);
        return ret;
    }*/
}
